This package includes the files needed to replicate the statistical tables and figures in "Polarization, Political Turnover, and the Stability of Democratic Foreign Policy."

Author: Matthew DiLorenzo
Journal: Foreign Policy Analysis

Last updated 12/17/2025

The replication package contains the following files:

1. There are 3 data files in .csv format that are required to replicate the analysis. These are:
- polarization-sols-analysis-data.csv- polarization-affective-sols-analysis-data.csv- alliance-reliability-polarization-data.csv
Note: These data files should placed in a new folder called "data" in the user's working directory before running the R script.

2. models.R - This is an R script that replicates all of the tables and figures in the main text and appendix. Note that I added lines to the beginning of the script to delete (if they exist) and regenerate the "tables" and "figures" folders to hold the output of the R script. 

3. r-console-output-from-replication-12172025.txt - This is a log file of the RStudio console output from the last time the entire script was run on 12/17/2025.




HOW TO REPLICATE THE ANALYSIS

Download all files and put them in a folder. The three data file mentioned above should be placed in a folder called "data". Open the models.R script file. The following packages must be installed and/or loaded in R for the script to run successfully:

foreign
tidyverse
readxl
stargazer
plm

If these packages are not already installed, they can be installed using the install.packages() command.

At the beginning of the R script (line 20) there is a line of code where the user should set the working directory to the folder containing the "data" folder. After that, the script can be run and should output the results to the "tables" and "figures" folders.


